#include <iostream>
#include <unistd.h>
#include "../src/SSP_College.hpp"
#include "../src/h264Save_gst.hpp"

const char* savePath="test.mkv";
const char* cameraIP="192.168.1.104";

SSPCollege* ssp_main;
H264Save* saver;

void Handle_SIGINT(int)
{

}

void Handle_H264Data(const char* data,std::size_t size,unsigned long frameID,std::any& userData)
{
  saver->InputH264(data,size);
}

int main()
{
  gst_init(nullptr,nullptr);
  saver=new H264Save(savePath);
  std::cout<<"Camera boot ... "<<std::endl;
  ssp_main=new SSPCollege({{cameraIP,0}},Handle_H264Data);
  std::cout<<"Camera boot finish"<<std::endl;
  sleep(1);
  std::cout<<"Record start ..."<<std::endl;
  ssp_main->StartShot();
  sleep(20);
  ssp_main->StopShot();
  std::cout<<"Record Stop ..."<<std::endl;

  delete ssp_main;
  delete saver;
}
